<!DOCTYPE html>
<html>
<head>
    <style>
        div
        {
            width:100px;
            height:100px;
            background:red;
            position:relative;
            animation-name:myfirst;
            animation-duration:5s;
            animation-timing-function:linear;
            animation-delay:2s;
            animation-iteration-count:infinite;
            animation-direction:alternate;
            animation-play-state:running;
            /*transform:rotate(90deg);*/
        }

        @keyframes myfirst
        {
            0%   {
                transform:rotate(0deg);
                margin-left: 45px;
            }
            50%  {
                transform:rotate(45deg);
            }
            100% {
                transform:rotate(90deg);
            }
        }

    </style>
</head>
<body>
<div></div>
</body>
</html>
